<?php

class Core_Form_Admincp_Mail_Add extends Nuo_Form
{
	function init()
	{
		$this -> setName('mailTemplate');

		$this -> setTitle('Edit Mail Template');

		$this -> addChild('text', 'template_key', array(
			'label' => 'Title',
			'desc' => 'form-desc.Template Key',
		));

		$this -> addChild('text', 'plugin', array(
			'label' => 'Plugin',
			'desc' => 'form-desc.Plugin',
		));

		/*
		$this -> addChild('select', 'module_id', array(
			'label' => 'Module',
			'desc' => 'form-desc.Module',
			'multiOptions' => Nuo::getTable('core/module') -> getMultiOptions(),
		));
		 * 
		 */

		$id = Nuo::getRequest() -> getParam('template_id');

		$baseUrl = Nuo::getUrl('admincp/core/mail/edit', array('template_id' => $id));

		$this -> addChild('select', 'lang_id', array(
			'label' => 'Language',
			'desc' => 'form-desc.Language',
			'value' => '',
			'multiOptions' => Nuo::getTable('core/language') -> getMultiOptions(),
			'onchange' => "document.location.href='{$baseUrl}'+'&lang_id='+\$(this).val()",
		));

		$this -> addChild('text', 'subject', array(
			'label' => 'Mail Subject',
			'desc' => 'form-desc.Mail Subject',
		));

		$this -> addChild('textarea', 'body_html', array(
			'label' => 'Html Message',
			'desc' => 'form-desc.Html Message',
			'class' => 'mceEditor',
		));

		$this -> addChild('textarea', 'body_text', array(
			'label' => 'Altenate Plain Text Message',
			'desc' => 'form-desc.Altenate Plain Text Message'
		));

		$this -> addChild('group', '_footer');

		$this -> _footer -> addChild('submit', '_submit') -> addChild('cancel', '_cancel');
	}

}
